package com.hehe.app_test_backend.Service;

import com.hehe.app_test_backend.Mapper.*;
import com.hehe.app_test_backend.Model.*;
import com.hehe.app_test_backend.Util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestProjectService {
    @Autowired
    private TestProjectMapper mapper;

    public void add(TestProject obj) throws Exception {
        obj.setCreateTime(DateUtil.getTimeStamp());
        obj.setUpdateTime(DateUtil.getTimeStamp());
        mapper.add(obj);
    }

    public void delete(TestProject obj) throws Exception {
        mapper.delete(obj);
    }

    public void update(TestProject obj) throws Exception {
        obj.setUpdateTime(DateUtil.getTimeStamp());
        mapper.update(obj);
    }

    public List<TestProject> getAll() {
        return mapper.getAll();
    }

    public TestProject getSingle(Integer projectId) {
        return mapper.getSingle(projectId);
    }
}
